﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:extbehaviour="clr-namespace:WPFExtensions.AttachedBehaviours;assembly=WPFExtensions"
	mc:Ignorable="d"
	xmlns:local="clr-namespace:Faust.Andrew.MTG.Player"	
	xmlns:Faust_Andrew_MTG_Player_Shared="clr-namespace:Faust.Andrew.MTG.Player.Shared;assembly=Faust.Andrew.MTG.Player.Shared"	
	xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"	
	x:Class="Faust.Andrew.MTG.Player.PlayerSurface"
	x:Name="UserControl" Height="1500" Width="2500" BorderThickness="1" AllowDrop="True" Drop="UserControl_Drop">
	<UserControl.Resources>
		<Faust_Andrew_MTG_Player_Shared:GameCard x:Key="GameCardDataSource" d:IsDataSource="True"/>
		<local:PlayerState x:Key="PlayerStateDataSource" d:IsDataSource="True"/>
		<Style x:Key="ButtonFocusVisual">
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate>
						<Rectangle Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2" SnapsToDevicePixels="true"/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
			<GradientStop Color="#F3F3F3" Offset="0"/>
			<GradientStop Color="#EBEBEB" Offset="0.5"/>
			<GradientStop Color="#DDDDDD" Offset="0.5"/>
			<GradientStop Color="#CDCDCD" Offset="1"/>
		</LinearGradientBrush>
		<SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
		<Style x:Key="LockButtonStyle" TargetType="{x:Type ToggleButton}">
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
			<Setter Property="HorizontalContentAlignment" Value="Center"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="1"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ToggleButton}">
						<Microsoft_Windows_Themes:ButtonChrome x:Name="Chrome" SnapsToDevicePixels="true" RenderDefaulted="{TemplateBinding Button.IsDefaulted}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}">
							<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True"/>
						</Microsoft_Windows_Themes:ButtonChrome>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="#ADADAD"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</UserControl.Resources>

	<Grid x:Name="borderMain" Background="{Binding Player.IsTurn, Converter={StaticResource TurnToBackground}, ElementName=UserControl, Mode=OneWay}">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>
		<Canvas x:Name="canvas" Grid.RowSpan="2">
			<Grid Canvas.Top="1187.874">
				<ToggleButton HorizontalAlignment="Right" VerticalAlignment="Top" IsChecked="{Binding Player.IsDeckUnlocked, ElementName=UserControl, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Panel.ZIndex="10" Margin="0,8,7.999,0" Style="{DynamicResource LockButtonStyle}" Background="{x:Null}" BorderBrush="{x:Null}" BorderThickness="0" ToolTip="Allow other players to view deck">
					<Grid>
						<Image x:Name="imgLock" Source="images/lock.png" Width="32" Visibility="{Binding Player.IsDeckUnlocked, Converter={StaticResource VisibleIfNotTrue}, ElementName=UserControl, Mode=OneWay}"/>
						<Image x:Name="imgUnlock" Source="images/lock_off.png" Width="32" Visibility="{Binding Player.IsDeckUnlocked, Converter={StaticResource VisibleIfTrue}, ElementName=UserControl, Mode=OneWay}"/>
					</Grid>
				</ToggleButton>
				<Image Source="images/Back.png" PreviewDrop="Deck_PreviewDrop" PreviewMouseLeftButtonDown="Deck_PreviewMouseLeftButtonDown" PreviewMouseMove="Deck_PreviewMouseMove" PreviewMouseRightButtonDown="Deck_PreviewMouseRightButtonDown" Margin="0,0,-0.001,-0.001" VerticalAlignment="Bottom" d:LayoutOverrides="Width">
					<Image.ContextMenu>
						<ContextMenu>
							<MenuItem Header="_Draw">
								<MenuItem Header="Draw _One" Click="Draw_One" />
								<MenuItem Header="Draw _Seven" Click="Draw_Seven" />
								<MenuItem Header="Draw _Multiple" Click="Draw_Multiple" />
							</MenuItem>
							<MenuItem Header="_Search Deck" Click="Search_Deck" />
							<MenuItem Header="S_huffle Deck" Click="Shuffle_Deck" />
						</ContextMenu>
					</Image.ContextMenu>
				</Image>
			</Grid>
			<Image x:Name="imgGraveyard" Width="100" Height="100" Source="images/Tombstone.png" Canvas.Left="241.031" Canvas.Top="1389.999" PreviewDrop="Graveyard_PreviewDrop">
				<Image.ContextMenu>
					<ContextMenu>
						<MenuItem Header="_Search Graveyard" Click="Search_Graveyard"/>
					</ContextMenu>
				</Image.ContextMenu>
			</Image>
			<Label Width="948" Height="162" Canvas.Left="1542" Canvas.Top="1336" HorizontalContentAlignment="Center" VerticalContentAlignment="Stretch" FontSize="96" Content="{Binding Player.Name, ElementName=UserControl, Mode=OneWay}"/>
			</Canvas>
		<!--<ItemsControl x:Name="itemsControl" ItemsPanel="{DynamicResource PlayerSurfacePanelTemplate}" ItemTemplate="{DynamicResource PlayerSurfaceItemTemplate}" ItemsSource="{Binding Player.Cards, ElementName=UserControl, Mode=Default}" Margin="1" Grid.Row="1">
		</ItemsControl>-->
	</Grid>
</UserControl>